package com.esri.core.renderer;

import com.esri.core.internal.util.d;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonNode;

/* loaded from: classes.dex */
public class UniqueValueDefinition extends ClassificationDefinition {
    private static final String a = "fieldDelimiter";
    private static final String b = "uniqueValueFields";
    private ArrayList<String> c;
    private String d;

    public UniqueValueDefinition(List<String> list) {
        this.c = new ArrayList<>();
        this.d = ",";
        this._type = "uniqueValueDef";
        this.c.addAll(list);
    }

    public UniqueValueDefinition(JsonNode jsonNode) {
        super(jsonNode);
        this.c = new ArrayList<>();
        this.d = ",";
        JsonNode findValue = jsonNode.findValue(b);
        if (findValue != null && findValue.isArray()) {
            Iterator<JsonNode> it = findValue.iterator();
            while (it.hasNext()) {
                this.c.add(it.next().getValueAsText());
            }
        }
        this.d = d.a(jsonNode, a);
    }

    public ArrayList<String> getUniqueValueFields() {
        return this.c;
    }

    public void setFieldDelimiter(char c) {
        this.d = String.valueOf(c);
    }

    public char getFieldDelimiter() {
        return this.d.charAt(0);
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // com.esri.core.renderer.ClassificationDefinition
    public void toJson(JsonGenerator jsonGenerator) throws IOException, JsonGenerationException, Exception {
        super.toJson(jsonGenerator);
        jsonGenerator.writeArrayFieldStart(b);
        for (int i = 0; i < 3 && i < this.c.size(); i++) {
            jsonGenerator.writeString(this.c.get(i));
        }
        jsonGenerator.writeEndArray();
        jsonGenerator.writeStringField(a, this.d);
    }

    @Override // com.esri.core.renderer.ClassificationDefinition
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("UniqueValueDefinition [uniqueValueFields=");
        ArrayList<String> arrayList = this.c;
        sb.append(arrayList != null ? arrayList.subList(0, Math.min(arrayList.size(), 5)) : null);
        sb.append(", fieldDelimiter=");
        sb.append(this.d);
        sb.append("]");
        return sb.toString();
    }
}
